// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

// 接口暂缺类型定义，使用any代替
interface KnowledgeBaseSearch extends Record<string, any> {}
interface KnowledgeBaseOut extends Record<string, any> {}

/**
 * 获取知识库列表
 * @param input 知识库搜索参数
 * @returns 
 */
export async function knowledgeBaseList(input: KnowledgeBaseSearch, options?: RequestOptions) {
  return request<Array<KnowledgeBaseOut>>(`knowledge-base/list`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取知识库详情
 * @param id 知识库ID
 * @returns 
 */
export async function knowledgeBaseDetail(id: string, options?: RequestOptions) {
  return request<KnowledgeBaseOut>(`knowledge-base/detail`, {
    method: 'GET',
    params: { id },
    ...(options || {}),
  });
}

/**
 * 创建知识库
 * @param input 知识库信息
 * @returns 
 */
export async function knowledgeBaseCreate(input: any, options?: RequestOptions) {
  return request<KnowledgeBaseOut>(`knowledge-base`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 编辑知识库
 * @param id 知识库ID
 * @param input 知识库信息
 * @returns 
 */
export async function knowledgeBaseUpdate(id: any, input: any, options?: RequestOptions) {
  return request<boolean>(`knowledge-base`, {
    method: 'PUT',
    data: { ...input, id: id.id },
    ...(options || {}),
  });
}

/**
 * 删除知识库
 * @param input 知识库ID信息
 * @returns 
 */
export async function knowledgeBaseDelete(input: any, options?: RequestOptions) {
  return request<boolean>(`knowledge-base/delete`, {
    method: 'DELETE',
    params: input,
    ...(options || {}),
  });
}

/**
 * 获取所有知识库
 * @returns 
 */
export async function knowledgeBaseGetAll(options?: RequestOptions) {
  return request<Array<KnowledgeBaseOut>>(`knowledge-base`, {
    method: 'GET',
    ...(options || {}),
  });
} 